
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _ORDENCOMPRA
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "ORDENCOMPRA"
			Me.MappingName = "ORDENCOMPRA"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_ORDENCOMPRALoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal CodOrdenCompra As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_ORDENCOMPRA.Parameters.CodOrdenCompra, CodOrdenCompra)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_ORDENCOMPRALoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property CodOrdenCompra As SqlParameter
                Get
                    Return New SqlParameter("@CodOrdenCompra", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Fecha As SqlParameter
                Get
                    Return New SqlParameter("@Fecha", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodProveedor As SqlParameter
                Get
                    Return New SqlParameter("@CodProveedor", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property NroOrdenCompra As SqlParameter
                Get
                    Return New SqlParameter("@NroOrdenCompra", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property CodResponsable As SqlParameter
                Get
                    Return New SqlParameter("@CodResponsable", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property EstadoOrdenCompra As SqlParameter
                Get
                    Return New SqlParameter("@EstadoOrdenCompra", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property CodUsuario As SqlParameter
                Get
                    Return New SqlParameter("@CodUsuario", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property FechaActualizacion As SqlParameter
                Get
                    Return New SqlParameter("@FechaActualizacion", SqlDbType.DateTime, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const CodOrdenCompra As String = "codOrdenCompra"
            Public Const Fecha As String = "fecha"
            Public Const CodProveedor As String = "codProveedor"
            Public Const NroOrdenCompra As String = "nroOrdenCompra"
            Public Const CodResponsable As String = "codResponsable"
            Public Const EstadoOrdenCompra As String = "estadoOrdenCompra"
            Public Const CodUsuario As String = "codUsuario"
            Public Const FechaActualizacion As String = "fechaActualizacion"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodOrdenCompra) = _ORDENCOMPRA.PropertyNames.CodOrdenCompra
                    ht(Fecha) = _ORDENCOMPRA.PropertyNames.Fecha
                    ht(CodProveedor) = _ORDENCOMPRA.PropertyNames.CodProveedor
                    ht(NroOrdenCompra) = _ORDENCOMPRA.PropertyNames.NroOrdenCompra
                    ht(CodResponsable) = _ORDENCOMPRA.PropertyNames.CodResponsable
                    ht(EstadoOrdenCompra) = _ORDENCOMPRA.PropertyNames.EstadoOrdenCompra
                    ht(CodUsuario) = _ORDENCOMPRA.PropertyNames.CodUsuario
                    ht(FechaActualizacion) = _ORDENCOMPRA.PropertyNames.FechaActualizacion

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const CodOrdenCompra As String = "CodOrdenCompra"
            Public Const Fecha As String = "Fecha"
            Public Const CodProveedor As String = "CodProveedor"
            Public Const NroOrdenCompra As String = "NroOrdenCompra"
            Public Const CodResponsable As String = "CodResponsable"
            Public Const EstadoOrdenCompra As String = "EstadoOrdenCompra"
            Public Const CodUsuario As String = "CodUsuario"
            Public Const FechaActualizacion As String = "FechaActualizacion"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodOrdenCompra) = _ORDENCOMPRA.ColumnNames.CodOrdenCompra
                    ht(Fecha) = _ORDENCOMPRA.ColumnNames.Fecha
                    ht(CodProveedor) = _ORDENCOMPRA.ColumnNames.CodProveedor
                    ht(NroOrdenCompra) = _ORDENCOMPRA.ColumnNames.NroOrdenCompra
                    ht(CodResponsable) = _ORDENCOMPRA.ColumnNames.CodResponsable
                    ht(EstadoOrdenCompra) = _ORDENCOMPRA.ColumnNames.EstadoOrdenCompra
                    ht(CodUsuario) = _ORDENCOMPRA.ColumnNames.CodUsuario
                    ht(FechaActualizacion) = _ORDENCOMPRA.ColumnNames.FechaActualizacion

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const CodOrdenCompra As String = "s_CodOrdenCompra"
            Public Const Fecha As String = "s_Fecha"
            Public Const CodProveedor As String = "s_CodProveedor"
            Public Const NroOrdenCompra As String = "s_NroOrdenCompra"
            Public Const CodResponsable As String = "s_CodResponsable"
            Public Const EstadoOrdenCompra As String = "s_EstadoOrdenCompra"
            Public Const CodUsuario As String = "s_CodUsuario"
            Public Const FechaActualizacion As String = "s_FechaActualizacion"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property CodOrdenCompra As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodOrdenCompra)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodOrdenCompra, Value)
            End Set
        End Property

        Public Overridable Property Fecha As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Fecha)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Fecha, Value)
            End Set
        End Property

        Public Overridable Property CodProveedor As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodProveedor)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodProveedor, Value)
            End Set
        End Property

        Public Overridable Property NroOrdenCompra As String
            Get
                Return MyBase.Getstring(ColumnNames.NroOrdenCompra)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.NroOrdenCompra, Value)
            End Set
        End Property

        Public Overridable Property CodResponsable As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodResponsable)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodResponsable, Value)
            End Set
        End Property

        Public Overridable Property EstadoOrdenCompra As String
            Get
                Return MyBase.Getstring(ColumnNames.EstadoOrdenCompra)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.EstadoOrdenCompra, Value)
            End Set
        End Property

        Public Overridable Property CodUsuario As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodUsuario)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodUsuario, Value)
            End Set
        End Property

        Public Overridable Property FechaActualizacion As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaActualizacion)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaActualizacion, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_CodOrdenCompra As String
			Get
				If Me.IsColumnNull(ColumnNames.CodOrdenCompra) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodOrdenCompra)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodOrdenCompra)
				Else
					Me.CodOrdenCompra = MyBase.SetintAsString(ColumnNames.CodOrdenCompra, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fecha As String
			Get
				If Me.IsColumnNull(ColumnNames.Fecha) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fecha)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fecha)
				Else
					Me.Fecha = MyBase.SetDateTimeAsString(ColumnNames.Fecha, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodProveedor As String
			Get
				If Me.IsColumnNull(ColumnNames.CodProveedor) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodProveedor)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodProveedor)
				Else
					Me.CodProveedor = MyBase.SetintAsString(ColumnNames.CodProveedor, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_NroOrdenCompra As String
			Get
				If Me.IsColumnNull(ColumnNames.NroOrdenCompra) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.NroOrdenCompra)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.NroOrdenCompra)
				Else
					Me.NroOrdenCompra = MyBase.SetstringAsString(ColumnNames.NroOrdenCompra, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodResponsable As String
			Get
				If Me.IsColumnNull(ColumnNames.CodResponsable) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodResponsable)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodResponsable)
				Else
					Me.CodResponsable = MyBase.SetintAsString(ColumnNames.CodResponsable, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_EstadoOrdenCompra As String
			Get
				If Me.IsColumnNull(ColumnNames.EstadoOrdenCompra) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.EstadoOrdenCompra)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.EstadoOrdenCompra)
				Else
					Me.EstadoOrdenCompra = MyBase.SetstringAsString(ColumnNames.EstadoOrdenCompra, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodUsuario As String
			Get
				If Me.IsColumnNull(ColumnNames.CodUsuario) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodUsuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodUsuario)
				Else
					Me.CodUsuario = MyBase.SetintAsString(ColumnNames.CodUsuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaActualizacion As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaActualizacion) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaActualizacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaActualizacion)
				Else
					Me.FechaActualizacion = MyBase.SetDateTimeAsString(ColumnNames.FechaActualizacion, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property CodOrdenCompra() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.CodOrdenCompra, Parameters.CodOrdenCompra)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Fecha() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Fecha, Parameters.Fecha)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodProveedor() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodProveedor, Parameters.CodProveedor)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property NroOrdenCompra() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.NroOrdenCompra, Parameters.NroOrdenCompra)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodResponsable() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodResponsable, Parameters.CodResponsable)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property EstadoOrdenCompra() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.EstadoOrdenCompra, Parameters.EstadoOrdenCompra)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodUsuario() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaActualizacion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property CodOrdenCompra() As WhereParameter 
			Get
				If _CodOrdenCompra_W Is Nothing Then
					_CodOrdenCompra_W = TearOff.CodOrdenCompra
				End If
				Return _CodOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As WhereParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property CodProveedor() As WhereParameter 
			Get
				If _CodProveedor_W Is Nothing Then
					_CodProveedor_W = TearOff.CodProveedor
				End If
				Return _CodProveedor_W
			End Get
		End Property

		Public ReadOnly Property NroOrdenCompra() As WhereParameter 
			Get
				If _NroOrdenCompra_W Is Nothing Then
					_NroOrdenCompra_W = TearOff.NroOrdenCompra
				End If
				Return _NroOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property CodResponsable() As WhereParameter 
			Get
				If _CodResponsable_W Is Nothing Then
					_CodResponsable_W = TearOff.CodResponsable
				End If
				Return _CodResponsable_W
			End Get
		End Property

		Public ReadOnly Property EstadoOrdenCompra() As WhereParameter 
			Get
				If _EstadoOrdenCompra_W Is Nothing Then
					_EstadoOrdenCompra_W = TearOff.EstadoOrdenCompra
				End If
				Return _EstadoOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As WhereParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As WhereParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Private _CodOrdenCompra_W As WhereParameter = Nothing
		Private _Fecha_W As WhereParameter = Nothing
		Private _CodProveedor_W As WhereParameter = Nothing
		Private _NroOrdenCompra_W As WhereParameter = Nothing
		Private _CodResponsable_W As WhereParameter = Nothing
		Private _EstadoOrdenCompra_W As WhereParameter = Nothing
		Private _CodUsuario_W As WhereParameter = Nothing
		Private _FechaActualizacion_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_CodOrdenCompra_W = Nothing
			_Fecha_W = Nothing
			_CodProveedor_W = Nothing
			_NroOrdenCompra_W = Nothing
			_CodResponsable_W = Nothing
			_EstadoOrdenCompra_W = Nothing
			_CodUsuario_W = Nothing
			_FechaActualizacion_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property CodOrdenCompra() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodOrdenCompra, Parameters.CodOrdenCompra)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fecha, Parameters.Fecha)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodProveedor() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodProveedor, Parameters.CodProveedor)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property NroOrdenCompra() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.NroOrdenCompra, Parameters.NroOrdenCompra)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodResponsable() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodResponsable, Parameters.CodResponsable)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property EstadoOrdenCompra() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.EstadoOrdenCompra, Parameters.EstadoOrdenCompra)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property CodOrdenCompra() As AggregateParameter 
			Get
				If _CodOrdenCompra_W Is Nothing Then
					_CodOrdenCompra_W = TearOff.CodOrdenCompra
				End If
				Return _CodOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property CodProveedor() As AggregateParameter 
			Get
				If _CodProveedor_W Is Nothing Then
					_CodProveedor_W = TearOff.CodProveedor
				End If
				Return _CodProveedor_W
			End Get
		End Property

		Public ReadOnly Property NroOrdenCompra() As AggregateParameter 
			Get
				If _NroOrdenCompra_W Is Nothing Then
					_NroOrdenCompra_W = TearOff.NroOrdenCompra
				End If
				Return _NroOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property CodResponsable() As AggregateParameter 
			Get
				If _CodResponsable_W Is Nothing Then
					_CodResponsable_W = TearOff.CodResponsable
				End If
				Return _CodResponsable_W
			End Get
		End Property

		Public ReadOnly Property EstadoOrdenCompra() As AggregateParameter 
			Get
				If _EstadoOrdenCompra_W Is Nothing Then
					_EstadoOrdenCompra_W = TearOff.EstadoOrdenCompra
				End If
				Return _EstadoOrdenCompra_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Private _CodOrdenCompra_W As AggregateParameter = Nothing
		Private _Fecha_W As AggregateParameter = Nothing
		Private _CodProveedor_W As AggregateParameter = Nothing
		Private _NroOrdenCompra_W As AggregateParameter = Nothing
		Private _CodResponsable_W As AggregateParameter = Nothing
		Private _EstadoOrdenCompra_W As AggregateParameter = Nothing
		Private _CodUsuario_W As AggregateParameter = Nothing
		Private _FechaActualizacion_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_CodOrdenCompra_W = Nothing
		_Fecha_W = Nothing
		_CodProveedor_W = Nothing
		_NroOrdenCompra_W = Nothing
		_CodResponsable_W = Nothing
		_EstadoOrdenCompra_W = Nothing
		_CodUsuario_W = Nothing
		_FechaActualizacion_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_ORDENCOMPRAInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.CodOrdenCompra.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_ORDENCOMPRAUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_ORDENCOMPRADelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodOrdenCompra)
		p.SourceColumn = ColumnNames.CodOrdenCompra
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodOrdenCompra)
		p.SourceColumn = ColumnNames.CodOrdenCompra
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fecha)
		p.SourceColumn = ColumnNames.Fecha
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodProveedor)
		p.SourceColumn = ColumnNames.CodProveedor
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.NroOrdenCompra)
		p.SourceColumn = ColumnNames.NroOrdenCompra
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodResponsable)
		p.SourceColumn = ColumnNames.CodResponsable
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.EstadoOrdenCompra)
		p.SourceColumn = ColumnNames.EstadoOrdenCompra
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodUsuario)
		p.SourceColumn = ColumnNames.CodUsuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaActualizacion)
		p.SourceColumn = ColumnNames.FechaActualizacion
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

